#include "PortScan.h" //Include your modified(from Template) .h

/*
	Use PORTSCAN_DETECTOR to try to detect portscans	
*/

template<typename T,typename R>
__device__ void COMPOUND_NAME(ANALYSIS_NAME,mining)(packet_t* GPU_buffer, T* GPU_data, R* GPU_results,analysisState_t state){
	
	/* CUDA CODE: Implement MINING code here */
	$PORTSCAN_DETECTOR$AUTO_MINE();
}

template<typename T,typename R>
__device__ void COMPOUND_NAME(ANALYSIS_NAME,filtering)(packet_t* GPU_buffer, T* GPU_data, R* GPU_results,analysisState_t state){
	
	/* CUDA CODE: Implement PreAnalysis Routine Filtering here. Use predefined Filtering tool or Implement code here IF NECESSARY */

}

template<typename T,typename R>
__device__ void COMPOUND_NAME(ANALYSIS_NAME,analysis)(packet_t* GPU_buffer, T* GPU_data, R* GPU_results,analysisState_t state){

	/* CUDA CODE: Implement Analysis Routine here. Use a predefined Analysis or Implement code here */
	$PORTSCAN_DETECTOR$ANALYSIS(14);

}

template<typename T,typename R>
__device__ void COMPOUND_NAME(ANALYSIS_NAME,operations)(packet_t* GPU_buffer, T* GPU_data, R* GPU_results,analysisState_t state){
	
	/* CUDA CODE: Implement post Analysis Operations/Filtering here. Use predefined Operations/Filtering tools or Implement code here IF NECESSARY */
	
	//use MULTI_THRESHOLDS submodule to modify to 3 the threshold for ipsrc 71.170.75.120
	 $PORTSCAN_DETECTOR$MULTI_THRESHOLDS$MODIFY_THRESHOLD(RESULT_ELEMENT.ipSrc==IP4(71,170,75,120),30);
}

template<typename R>
void COMPOUND_NAME(ANALYSIS_NAME,hooks)(PacketBuffer* packetBuffer,R* results, analysisState_t state, int64_t* auxBlocks){
	
	/* HOST CODE: Implement HOOKS code here. Use predefined hooks or define new ones. */

	//Dump to file
	//$PORTSCAN_DETECTOR$DUMPER$DUMP_ALARMS_TO_FILE("PSalarms",2,3);

	//Dump to stderr
	$PORTSCAN_DETECTOR$DUMPER$DUMP_ALARMS_TO_STDERR(2,3);

	//Dump alarms to db
	$PORTSCAN_DETECTOR$DB_DUMPER$DUMP_ALARMS();
}


